<?php

namespace app\admin\controller;

use think\Db;
use think\response\Json;

Class Order extends Base
{


    public function list(){
        $obj = Db::table("tb_order")->order('id', 'desc');
        $param = $this->request->get();
        if (isset($param['word']) && $param['word']) {
            $obj->where('order_id|name', "like","%".$param['word']."%");
        }
        if (isset($param['status']) && $param['status']) {
            $obj->where('status',$param['status']);
        }
        if (isset($param['pay_status']) && $param['pay_status']) {
            $obj->where('pay_status',$param['pay_status']);
        }
        if (isset($param['start']) && $param['start']) {
            $obj->where('create_time', '>', $param['start'] . " 00:00:00");
        }
        if (isset($param['end']) && $param['end']) {
            $obj->where('create_time', '<', $param['end'] . " 00:00:00");
        }
        $list = $obj->paginate(10, false, ['query' => $this->request->param()]);
        return view('', ['list' => $list]);
    }

    public function goods(){
        $obj = Db::table("tb_order")->field("good_id as id,plan,money,img")->order('id', 'desc');
        $list = $obj->paginate(10, false, ['query' => $this->request->param()]);
        return view('', ['list' => $list]);
    }



}